fun downloadFile(url: String, onSuccess: () -> Unit, onFailure: (String) -> Unit) {
    // 模拟下载文件
    val success = true

    if (success) {
        onSuccess()
    } else {
        onFailure("Download failed")
    }
}

fun main() {
    downloadFile("https://example.com/file.txt",
        onSuccess = {
            println("Download succeeded")
        },
        onFailure = { error ->
            println("Error: $error")
        })
}